package com.ll.example.springbootwebdemokotlin.controller

import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.ResponseBody
import org.springframework.web.bind.annotation.RestController
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap

@Controller
class HelloController {
    @ResponseBody
    @RequestMapping("/hello")
    fun sayHello():String{
        return "hello hello"
    }

    @RequestMapping("/success")
    fun success(map: HashMap<String,String>):String{

        map["hello"] = "<h1>test-测试测试</h1>"

       return "success"
    }

    @RequestMapping("/success2")
    fun success2(map:HashMap<String,List<String>>):String{
        val list= listOf("张三","李四","王五")
//        val list = ArrayList<String>()
//        list.add("张三")
//        list.add("李四")
        map["users"] =list


        return "success2"
    }
}